<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>表单校验 - Xui Demo</title>
	<!-- demo data -->
	<link rel="stylesheet" type="text/css" href="../demo.css">
	<script type="text/javascript" src="../demo_data.js"></script>
	
	<!-- xui -->
	<link rel="stylesheet" type="text/css" href="../../xui.css">
	<script type="text/javascript" src="../../jquery.min.js"></script>
	<script type="text/javascript" src="../../xui.js"></script>
	
	<!-- xcheck -->
	<script type="text/javascript">
		$(function(){
			/**
			 *	================== 表单自动验证 ==================
			 */
			var xform = $("#xform").xform({
				xcombo:[{
					id:'#xcombox',
					xdata:$xdata_xcombox		//静态数据
					//url:"$xdata_xcombox"	//后台返回数据格式参考 $xdata_xcombox
				}],
				xcheck:[			//表单验证
    				{label:'商品', name:'goods', xcheck:'null', msgBox:'.f_goods_error'}
				]
				//url:"表单提交地址"
				//其他表单参数请参考表单demo或xui.js源码xform—>defaults
			});
			
			$("#submit").click(function(){
				xform.submit();
			});
		})
	</script>
</head>
<body>
	<h2>表单校验</h2>
	<form class="xform" id="xform">
		<div class="xgroup">
			<label class="g1">商品</label>
			<div class="g2">
				<div class="xcombo" data-name="goods" id="xcombox">
			  		<ul class="xtemplate">
				   		<li data-xv="{name}">{name}</li>
				   	</ul>
			  	</div>
			  	<div class="error f_goods_error"></div>
			</div>
		</div>
		<div class="xbar">
			<span class="xbtn" id="submit">提交</span>
		</div>
	</form>
	<div class="xinfo"></div>
</body>
</html>